/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package idea.countries;


import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;


/**
 *
 * @author rejun001
 */
public class Country implements Transferable
{
    public static final DataFlavor DATA_FLAVOR = new DataFlavor(Country.class, "country");
    String name;


    public String getName()
    {
        return name;
    }


    public void setName( String name )
    {
        this.name = name;
    }


    @Override
    public DataFlavor[] getTransferDataFlavors()
    {
        return new DataFlavor[]{DATA_FLAVOR};
    }


    @Override
    public boolean isDataFlavorSupported( DataFlavor flavor )
    {
        return flavor == DATA_FLAVOR;
    }


    @Override
    public Object getTransferData( DataFlavor flavor ) throws UnsupportedFlavorException , IOException
    {
        if (flavor == DATA_FLAVOR) {
            return this;
        }
        else {
            throw new UnsupportedFlavorException(flavor);
        }
    }
    
    
}
